namespace EyeOpen.DataEntry.Web.Mvc
{
	using System;
	using System.Collections.Generic;
	using System.Web.Mvc;

	using EyeOpen.DataEntry.Data;

	public class CustomDependencyResolver 
		: IDependencyResolver
	{
		public object GetService(Type serviceType)
		{
			if (serviceType == typeof(CustomerController))
			{
				return 
					new CustomerController(DependencyResolver.Current.GetService<IShopUnitOfWork>());
			}

			if (serviceType == typeof(IShopUnitOfWork))
			{
				return
					new ShopUnitOfWorkFactory().GetDb();
			}

			if (serviceType == typeof(IShopDb))
			{
				return
					new ShopUnitOfWorkFactory().Create();
			}

			return null;
		}

		public IEnumerable<object> GetServices(Type serviceType)
		{
			return 
				new List<object>();
		}
	}
}